Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for historical data #27

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

yushdotkapoor
Copy link

We can now query historical fear and greed data from the can data source directly. The default range of data that is returned is 1 year.

Copy link
Owner

@vterron vterron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing this!

src/fear_and_greed/cnn.py Outdated Show resolved Hide resolved
last_update=datetime.datetime.fromtimestamp(data["x"] / 1000),
))

return fear_greed_historical
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the values in response["data"] guaranteed to be sorted by date?

Consider sorting them here to return the response is deterministic.

src/fear_and_greed/cnn.py Outdated Show resolved Hide resolved
src/fear_and_greed/cnn.py Show resolved Hide resolved
@vterron
Copy link
Owner

vterron commented Dec 10, 2024

Please update the README as well, to surface this new function to users of the library.

yushdotkapoor and others added 4 commits December 10, 2024 17:29
I'm still a git noob it seems, wasn't aware that subsequent commits get automatically included in pull request
The historical method raises error when no data is found
Additionally, the data is sorted from distant to most recent in case the data source provides unsorted data
Tests for the correct number of entries.
Tests the first and last 5 entries of the historical data to make sure dataset is sorted in the correct order.
I chose not to cross check the entire dataset to prevent bloating. We can reasonable assume based on the first and last five entries that method works as expected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants